#ifndef LABYRINTH_H_
#define LABYRINTH_H_

#include "Position.h"
#include "Cell.h"

#include <stdexcept>

class Labyrinth {
public:
	static const unsigned int WIDTH = 7;
	static const unsigned int HEIGHT = 7;

	friend ostream & operator <<(ostream & outputStream, const Labyrinth & labyrinth);

	Labyrinth();
	Labyrinth(const char labyrinth[HEIGHT][WIDTH]);

	void rebuild();
	bool isOnEdge(const Position & position) const;
	const Cell & getCell(const Position & position) const throw (out_of_range);
	void setCell(const Position & position, const Cell & cell ) throw (out_of_range, invalid_argument);
private:

	bool hasExit(Position position);
	void fillRandomly();
	void clean();

	Cell labyrinth[HEIGHT][WIDTH];
	bool useExternalLabyrinth;
};

#endif /* LABYRINTH_H_ */
